<?php

  //
  // Memorii Web
  // script/add_subfolder.php
  //
  // Creation of a new user account.
  //
  
  session_start();
  
  require_once('../const.php');
  require_once('../db/db.php');
  
  $folder_id = '0';
  if( isset($_SESSION['current_folder_id'])) {
  	$folder_id = $_SESSION['current_folder_id'];
  }
  $new_name = 'New name';
  if( isset($_POST['new_name'])) {
  	$new_name = $_POST['new_name'];
  }
  
  $db_connection = db_connect();
  db_rename_folder($db_connection, $folder_id, $new_name);
  db_disconnect($db_connection);

  echo '<div class="msg">Folder renamed.</div>';
  
  include('../../content/folder.php');
?>